Inside Macintosh: QuickTime Components

Previous | Chapter Top | Chapter Contents | Next

Processing Your Panel's Events

When your panel component is loaded into the settings dialog box and active, you may receive and process dialog events and mouse clicks.

Your component's SGPanelEvent function acts like a modal-dialog filter function, allowing you to process individual dialog events. The sequence grabber calls your SGPanelItem function whenever the user clicks a dialog item.

Whenever the user clicks the OK button, the sequence grabber calls your SGPanelValidateInput function. Your panel component may then validate the user's settings.

SGPanelItem

Your SGPanelItem function allows your component to receive and process mouse clicks in the settings dialog box.

pascal ComponentResult SGPanelItem (SeqGrabComponent s,
                                          SGChannel c, DialogPtr d,
                                          short itemOffset,
                                          short itemNum);
s
Identifies the sequence grabber component's connection to your panel component.
c
Identifies a connection to the sequence grabber channel associated with your panel component.
d
Contains a dialog pointer identifying the settings dialog box.
itemOffset
Specifies the offset to your panel's first item in the dialog box.
itemNum
Contains the item number of the dialog item selected by the user. Note that this is an absolute item number; the sequence grabber does not adjust this value to account for the offset to your first dialog item.

DESCRIPTION

A sequence grabber component calls your SGPanelItem function whenever the user clicks an item in the settings dialog box. Your component may then perform whatever processing is appropriate, depending upon the item number. Note that the sequence grabber provides an absolute item number. It is your responsibility to adjust this value to account for the offset to your panel's first item in the dialog box.

SEE ALSO

Your component can filter all dialog events with your SGPanelEvent function. This function is described next.

Sequence grabber components use your component's SGPanelValidateInput function to validate the current input settings as a whole. That function is discussed on SGPanelValidateInput .

SGPanelEvent

Your SGPanelEvent function allows your component to receive and process dialog events. This function is similar to a modal-dialog filter function.

pascal ComponentResult SGPanelEvent (SeqGrabComponent s,
                                          SGChannel c, DialogPtr d,
                                          short itemOffset,
                                          const EventRecord *theEvent,
                                          short *itemHit,
                                          Boolean *handled);
s
Identifies the sequence grabber component's connection to your panel component.
c
Identifies a connection to the sequence grabber channel associated with your panel component.
d
Contains a dialog pointer identifying the settings dialog box.
itemOffset
Specifies the offset to your panel's first item in the dialog box.
theEvent
Contains a pointer to an event structure. This event structure contains information identifying the nature of the event.
itemHit
Contains a pointer to a field that is to receive the item number in cases where your component handles the event. The number returned is an absolute, not a relative number, so it must be offset by the itemOffset parameter.
handled
Contains a pointer to a Boolean value. Set this Boolean value to indicate whether your component handles the event: set it to true if you handle the event; set it to false if you do not.

DESCRIPTION

A sequence grabber component calls your SGPanelEvent function whenever an event occurs in the settings dialog box. Your SGPanelEvent function is similar to a modal- dialog filter function. The main difference is that, rather than returning a Boolean value to indicate whether you handled the event, your SGPanelEvent function sets a Boolean value that is provided by the calling function. If you handle the event, be sure to update the field referred to by the itemHit parameter.

SEE ALSO

Your component can process mouse clicks with your SGPanelItem function. This function is discussed on SGPanelItem .

SGPanelValidateInput

Sequence grabber components call your component's SGPanelValidateInput function in order to allow you to validate the contents of the user dialog box.

pascal ComponentResult SGPanelValidateInput
                                          (SeqGrabComponent s,
                                          Boolean *ok);
s
Identifies the sequence grabber component's connection to your panel component.
ok
Contains a pointer to a Boolean value. You set this Boolean value to indicate whether the user's settings are acceptable. Set it to true if the settings are OK; otherwise, set it to false .

DESCRIPTION

A sequence grabber component calls your SGPanelValidateInput function in order to allow you to validate the settings chosen by the user. This is your opportunity to validate the settings in their entirety, including those for which you may not have received dialog events or mouse clicks. For example, if your panel component uses a TextEdit box, you should validate its contents at this time. Be sure to give the user some indication of what to do to fix the settings.

The sequence grabber calls this function when the user clicks the OK button. If the user clicks the Cancel button, the sequence grabber does not call this function.

You indicate whether the settings are acceptable by setting the Boolean value referred to by the ok parameter. If you set this Boolean value to false , the sequence grabber component ignores the OK button in the dialog box.

SEE ALSO

Your component can process mouse clicks with your SGPanelItem function, described on SGPanelItem . Your component can filter all dialog events with your SGPanelEvent function, described in the previous section.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next